home *** CD-ROM | disk | FTP | other *** search
- ;Height Change
- ;-------------
- ;Just a test routine for height and width alteration. Move the joystick
- ;up and left to see the screen change.
- ;
- ;Press fire to exit.
-
- opt o+
-
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- LOCAL = 1
-
- SECTION "HeightChange",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l ($4).w,a6
- lea GMS_Name(pc),a1
- moveq #$00,d0
- CALL OpenLibrary
- move.l d0,GMS_Base
- beq Quit
-
- move.l GMS_Base(pc),a6
- CALL SetUserPri
-
- move.l GMS_Base(pc),a6 ;Tell GMS that we want to add a
- lea ScreenStruct(pc),a0 ;screen for use.
- CALL Add_Screen
- tst.l d0
- bne.s Error
-
- move.l SS_MemPtr1(a0),a1 ;Destination = SS_MemPtr1.
- lea PackedPicFile(pc),a0 ;File Name.
- CALL QuickLoad
- tst.l d0
- beq.s Error
-
- lea ScreenStruct(pc),a0 ;Unpack the data on top of itself.
- move.l SS_MemPtr1(a0),a1
- move.l a1,a0
- moveq #$00,d0
- CALL SmartUnpack
-
- lea ScreenStruct(pc),a0 ;Now show the screen/pic.
- CALL Show_Screen
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Loop: moveq #JPORT2,d0 ;Read from port 2
- moveq #JT_SWITCH,d1
- CALL Read_JoyPort ;Go get joystick status.
- btst #JS_FIRE1,d0
- bne.s Fade_Here
-
- .TRight btst #JS_RIGHT,d0 ;This is the routine that moves
- beq.s .TLeft ;the screen routine around. All
- addq.w #1,SS_Scr_Width(a0) ;it does is change the X/Y co-ords
- .TLeft btst #JS_LEFT,d0 ;for the top of the screen.
- beq.s .TUp ;Calling Reposition_Screen will
- subq.w #1,SS_Scr_Width(a0) ;then update these changes.
- .TUp btst #JS_UP,d0
- beq.s .TDown
- subq.w #1,SS_Scr_Height(a0)
- .TDown btst #JS_DOWN,d0
- beq.s .done
- addq.w #1,SS_Scr_Height(a0)
-
- .done CALL Wait_OSVBL ;Always wait for a VBL first.
- CALL Remake_Screen ;Reposition the screen now.
- bra.s Loop
-
- Fade_Here:
- .Fade CALL Wait_OSVBL ;Keep looping until the fade is
- CALL B12_FadeToBlack ;completely finished (ie all
- tst.w d0 ;colours are black).
- bne.s .Fade
-
- moveq #25,d0 ;Wait 1/2 second before we exit.
- CALL Wait_Time
-
- ;===========================================================================;
- ; RETURN TO DOS
- ;===========================================================================;
-
- CALL Delete_Screen ;Give back screen memory etc.
- Error move.l GMS_Base(pc),a1
- move.l ($4).w,a6
- CALL CloseLibrary
- Quit MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #$00,d0
- rts
-
- ;===========================================================================;
- ; CODE-RELATIVE DATA
- ;===========================================================================;
-
- GMS_Name:
- dc.b "games.library",0
- even
- GMS_Base:
- dc.l 0
-
- AMT_PLANES = 5
-
- ScreenStruct:
- dc.l "GSV1"
- dc.l 0,0,0 ;Screen_Mem1/2/3
- dc.l 0 ;Screen link.
- dc.l ScreenPalette ;Address of screen palette
- dc.l 0 ;Address of rasterlist.
- dc.l 0 ;Amt of colours in palette.
- dc.w 256,320,320/8 ;Screen Height, Width, Width/8
- dc.w 256,320,320/8 ;Pic Height, Width, Width/8
- dc.w AMT_PLANES ;Amt_Planes
- dc.w 0,0 ;Top Of Screen offset, X/Y
- dc.w 0 ;Scroll buffer in pixels/8.
- dc.w 0 ;X counter (for hor. scrolling).
- dc.w 0 ;Y counter (for ver. scrolling).
- dc.l NOBURST ;Special attributes.
- dc.w LORES ;Screen mode.
- dc.b INTERLEAVED ;Screen type
- dc.b 0 ;Screen Is Being Displayed?
- dc.l 0,0 ;Reserved area.
- even
-
- ScreenPalette:
- dc.w $0000,$0A77,$0B88,$0866,$0A98,$0877,$0B99,$0CBB
- dc.w $0ABB,$0CCC,$0333,$0554,$0556,$0665,$0788,$0222
- dc.w $0466,$0345,$0677,$0888,$0234,$0322,$0844,$0733
- dc.w $0632,$0955,$09AA,$0022,$0832,$0943,$0DCC,$0DDD
-
- PackedPicFile:
- IFNE LOCAL
- dc.b "GAMESLIB:"
- ENDC
- dc.b "data/Pic320.pak",0
- even
-
-